class mgselectlist_iter:
	def __init__(self, selectlist):
		self.selectlist = selectlist
		self.position = 1
		self.length = mgGetRecListCount(self.selectlist)
	
	def __iter__(self):
		self.position = 1
		self.length = mgGetRecListCount(self.selectlist)
		return self
	
	def next(self):
		if self.position <= self.length:
			rec, mat = mgGetNthRecInList(self.selectlist, self.position)
			self.position += 1
			return rec, mat
		else:
			raise StopIteration

def mgselectlist_iter__(self):
	return mgselectlist_iter(self)

def mgselectlist_len(self):
	return mgGetRecListCount(self)
	
def mgselectlist_nonzero(self):
	return (mgGetRecListCount(self) != 0)

def mgselectlist_contains(self, rec):
	return mgIsRecInList(self, rec)

mgselectlist_t.__iter__ = mgselectlist_iter__
mgselectlist_t.__getitem__ = mgGetNthRecInList
mgselectlist_t.__len__ = mgselectlist_len
mgselectlist_t.__nonzero__ = mgselectlist_nonzero
mgselectlist_t.__contains__ = mgselectlist_contains